#include <stdio.h>


double rand0_1(double *r)
{
    double base=256.0;
    double a=17.0;
    double b=139.0;
    double temp1=a*(*r)+b;
    //printf("%lf",temp1);
    double temp2=(int)(temp1/base); //得到余数
    double temp3=temp1-temp2*base;
    //printf("%lf\n",temp2);
    //printf("%lf\n",temp3);
    *r=temp3;
    double p=*r/base;
    return p;
}

int main()
{
    double m=100.0,n=500.0;
    double r=5.0;
    printf("output 10 number between 0 and 1:\n");
    for (int i = 0; i < 20; i++)
    {
        printf("%10.5lf\n",m+(n-m)*rand0_1(&r));
    }
    return 0;
}
